Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 14, 2026

Addresses code review feedback on PR #537 identifying compilation errors and code quality issues in the Web4 CLI functional test suite.

Compilation Fixes

state_verifier.rs: Replaced ? operator with explicit error handling in bool-returning methods:

// Before (compilation error)
pub fn manifest_has_fields(&self, domain: &str, required_fields: &[&str]) -> bool {
    let manifest = self.get_manifest(domain)?;  // ❌ Can't use ? in bool-returning function
    // ...
}

// After
pub fn manifest_has_fields(&self, domain: &str, required_fields: &[&str]) -> bool {
    if let Some(manifest) = self.get_manifest(domain) {
        // ...
    } else {
        false
    }
}

Same fix applied to verify_persistence() method.

Code Quality Improvements

  • web4_functional.rs: Renamed module supportweb4_functional_support with explicit #[path] attribute to match directory structure
  • web4_functional.rs: Renamed variable resultdeploy_result for clarity in deployment test
  • run_web4_functional_tests.sh: Initialized missing BUILD_MODE variable (defaults to "debug")

Changes

  • zhtp-cli/tests/web4_functional/state_verifier.rs (20 lines)
  • zhtp-cli/tests/web4_functional.rs (9 lines)
  • zhtp-cli/scripts/run_web4_functional_tests.sh (1 line)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Fix compilation errors in state_verifier.rs (? operator in bool methods)
- Rename 'support' module to 'web4_functional_support' for clarity
- Improve variable naming (result -> deploy_result)
- Initialize BUILD_MODE variable in test runner script

Co-authored-by: umwelt <[email protected]>
Copilot AI changed the title [WIP] Add Web4 CLI functional testing framework fix: Resolve compilation errors and improve code clarity in Web4 functional tests Jan 14, 2026
Copilot AI requested a review from umwelt January 14, 2026 11:54
@umwelt umwelt marked this pull request as ready for review January 14, 2026 12:16
@umwelt umwelt merged commit 67a9245 into feature/web4-cli-complete-functional-testing Jan 14, 2026
@umwelt umwelt deleted the copilot/sub-pr-647 branch January 14, 2026 12:16
umwelt added a commit that referenced this pull request Jan 14, 2026
… (#647)

* feat: Implement Development Grants Fund contract (SOV-L0-2.3)

- Implement core DevelopmentGrants contract with fee collection and governance-controlled disbursements
- Add comprehensive type definitions: ProposalId, Amount, Recipient, Disbursement
- Enforce all 10 invariant sections:
  * Fee routing validation (F1, F2): Passive receiver with amount > 0 check
  * Account balance conservation (A1, A2, A3): balance = fees - disbursements, append-only ledger
  * Governance authority (G1, G2, G3): Governance-only, proposal binding, replay protection
  * State mutation (S1, S3): Deterministic, no reentrancy risk
  * Boundary conditions: Overflow/underflow checks, edge cases
  * Year-5 target (T2): Correctly non-enforceable at contract level
  * Upgrade compatibility (U1): Serializable state for persistence
  * Read-only registry (U2): No external contract calls
  * Failure modes: All errors halt execution explicitly
  * Security boundary: No arbitrary withdrawals, governance-only control
- Add 13 comprehensive unit tests covering all invariant classes
- All tests passing (100% pass rate)

* test: [Web4 CLI #537] Complete Functional Testing (Domains & Deployments)

- Add comprehensive Web4 CLI functional test suite
- Implement 7-phase testing (Registration → Deployment → Persistence → Updates → Rollback → Deletion → Error Handling)
- Create automated test site generator with version tracking
- Add CLI command wrappers with proper parsing
- Implement state verification and persistence testing
- Add comprehensive error handling and edge case testing
- Include bug report template and test documentation
- Test manifest architecture (web4_manifest_cid vs manifest_cid)
- Validate persistence across node restarts (CRITICAL requirement)
- Test version rollback functionality
- Verify domain registration/deletion workflows
- All tests use proper CLI command execution and validation

Test Files:
- web4_functional.rs: 28+ test scenarios across 7 phases
- web4_functional/test_env.rs: Isolated test environment management
- web4_functional/cli_executor.rs: CLI command wrapper with parsing
- web4_functional/site_generator.rs: Automated test site creation
- web4_functional/state_verifier.rs: State verification utilities
- scripts/run_web4_functional_tests.sh: Automated test runner with reporting
- tests/WEB4_FUNCTIONAL_TESTING.md: Complete testing documentation
- tests/web4_functional_bug_report_template.md: Bug report template

Completes requirement: Test: Web4 CLI Complete Functional Testing (Domains & Deployments) #537

* fix: Resolve compilation errors and improve code clarity in Web4 functional tests (#775)

* Initial plan

* fix: Apply code review fixes for Web4 functional tests

- Fix compilation errors in state_verifier.rs (? operator in bool methods)
- Rename 'support' module to 'web4_functional_support' for clarity
- Improve variable naming (result -> deploy_result)
- Initialize BUILD_MODE variable in test runner script

Co-authored-by: umwelt <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: umwelt <[email protected]>

---------

Co-authored-by: supertramp <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: umwelt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants